package logic

import (
	"context"
	"fmt"
	"srv/models/mysql"

	"srv/house"
	"srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type HouseListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewHouseListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HouseListLogic {
	return &HouseListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *HouseListLogic) HouseList(in *house.HouseListRequest) (*house.HouseListResponse, error) {
	// todo: add your logic here and delete this line

	var h []*mysql.House
	var houses []*house.HouseList
	fmt.Println(h)
	//fmt.Println(houses)

	//for _, list := range h {
	//	houseList := house.HouseList{
	//		Name:    list.Name,
	//		Address: list.Address,
	//		Type:    list.Type,
	//		Area:    list.Area,
	//		Floor:   list.Floor,
	//		Price:   float32(list.Price),
	//		Remarks: list.Remarks,
	//	}
	//	houses = append(houses, &houseList)
	//}

	return &house.HouseListResponse{
		List: houses,
	}, nil
}
